//
// Decompiled by Jadx - 544ms
//
package gc;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.text.TextUtils;
import android.util.TypedValue;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.b;
import com.google.gson.Gson;
import dh.a;
import fi.c;
import fi.e;
import fi.w;
import fj.d;
import fm.i;
import fn.j;
import fn.y;
import gc.ac;
import gc.ag;
import gj.k;
import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;
import me.plusne.MainActivity;
import me.plusne.NativeTools;
import me.plusne.common.Json.JsonHomeAppList;
import me.plusne.common.Json.JsonHookStatic;
import me.plusne.common.Json.JsonSetting;
import me.plusne.common.Json.Login.JsonTempUserDecrypt;
import me.plusne.common.Json.Soul.JsonSoulGetUserInfos;
import me.plusne.common.Json.Soul.JsonSuccess;
import okhttp3.z;
import org.luckypray.dexkit.result.FieldData;
import r.f;
import r.g;
import r.h;

public final class aa implements Runnable {
    public final int a;
    public final Object b;
    public final Object c;

    public aa(int i, Object obj, Object obj2) {
        this.a = i;
        this.b = obj;
        this.c = obj2;
    }

    @Override
    public final void run() {
        int i;
        int i2;
        Toast toast;
        Object aa;
        f p;
        String message;
        StringBuilder sb;
        String str;
        f fVar;
        String str2;
        String str3;
        f fVar2;
        String str4;
        int i3 = this.a;
        int i4 = 0;
        Object obj = this.c;
        Object obj2 = this.b;
        switch (i3) {
            case 0:
                ac acVar = (ac) obj2;
                ac.c cVar = (ac.c) obj;
                Object aa2 = j.aa(acVar.db, "execute");
                if (aa2 == null) {
                    j.bi(new Object[]{"response is Null"});
                    return;
                }
                String df = acVar.df(aa2);
                if (!TextUtils.isEmpty(df) && (aa = j.aa(aa2, df)) != null) {
                    String str5 = (String) j.aa(aa, "string");
                    JsonHookStatic jsonHookStatic = y.by;
                    if (jsonHookStatic.getActivity() == null) {
                        jsonHookStatic.getMainHandler().post(new ab(cVar, str5, 0));
                        return;
                    } else {
                        jsonHookStatic.getActivity().runOnUiThread(new ab(cVar, str5, 1));
                        return;
                    }
                }
                return;
            case 1:
                ag agVar = (ag) obj2;
                ag.b bVar = (ag.b) obj;
                Object aa3 = j.aa(agVar.cr, "execute");
                if (aa3 == null) {
                    j.bi(new Object[]{"response is Null"});
                    return;
                }
                String str6 = (String) j.aa(j.aa(aa3, agVar.cu(aa3)), "string");
                JsonHookStatic jsonHookStatic2 = y.by;
                if (jsonHookStatic2.getActivity() == null) {
                    jsonHookStatic2.getMainHandler().post(new ae(bVar, str6, 0));
                    return;
                } else {
                    jsonHookStatic2.getActivity().runOnUiThread(new ae(bVar, str6, 1));
                    return;
                }
            case 2:
                AtomicReference atomicReference = (AtomicReference) obj;
                ArrayList arrayList = ap.cp;
                Iterator it = ((List) obj2).iterator();
                while (true) {
                    boolean hasNext = it.hasNext();
                    JsonHookStatic jsonHookStatic3 = y.by;
                    if (hasNext) {
                        for (c.a aVar : ((c) it.next()).getList()) {
                            if (aVar.isSelected()) {
                                ac acVar2 = new ac();
                                acVar2.de("https://post.soulapp.cn/v3/post/visibility?postId=" + aVar.getKey() + "&visibility=" + atomicReference, new HashMap(), "POST");
                                JsonSuccess m = g.m(acVar2.dh());
                                if (m == null) {
                                    b.r(jsonHookStatic3.getActivity(), "数据解析失败");
                                } else {
                                    if (m.isSuccess()) {
                                        i4++;
                                        p = new f(jsonHookStatic3.getActivity());
                                        p.k();
                                        message = aVar.getKey() + "\n修改成功";
                                    } else {
                                        p = b.p(jsonHookStatic3.getActivity());
                                        message = m.getMessage();
                                    }
                                    p.l(message);
                                }
                            }
                        }
                    } else {
                        jsonHookStatic3.getActivity().runOnUiThread(new ah(i4));
                        return;
                    }
                }
            case 3:
                aw awVar = (aw) obj2;
                i iVar = (i) obj;
                FieldData fieldData = aw.cp;
                awVar.getClass();
                JsonHookStatic jsonHookStatic4 = y.by;
                if (jsonHookStatic4.getSoul() != null && j.ae("SelectBirthday") && NativeTools.n(JsonHookStatic.l, jsonHookStatic4.getUserInfo())) {
                    String g = h.g(new Date(Long.parseLong(iVar.c)), (DateFormat) h.d.get());
                    if (awVar.cu != null && !Objects.equals(de.aa.am(g), "54岁!")) {
                        EditText editText = awVar.cu;
                        StringBuilder n = b.n("Ta的生日 : ", g, " ");
                        n.append(de.aa.am(g));
                        editText.setHint(n.toString());
                        return;
                    }
                    return;
                }
                return;
            case 4:
                aw awVar2 = (aw) obj2;
                JsonSoulGetUserInfos jsonSoulGetUserInfos = (JsonSoulGetUserInfos) obj;
                FieldData fieldData2 = aw.cp;
                awVar2.getClass();
                JsonHookStatic jsonHookStatic5 = y.by;
                if (jsonHookStatic5.getSoul() != null && j.ae("SelectBirthday") && NativeTools.n(JsonHookStatic.l, jsonHookStatic5.getUserInfo())) {
                    String g2 = h.g(new Date(((JsonSoulGetUserInfos.DataBean) jsonSoulGetUserInfos.getData().get(0)).getBirthday()), (DateFormat) h.d.get());
                    if (awVar2.cu != null && !Objects.equals(de.aa.am(g2), "54岁!")) {
                        EditText editText2 = awVar2.cu;
                        StringBuilder n2 = b.n("Ta的生日 : ", g2, " ");
                        n2.append(de.aa.am(g2));
                        editText2.setHint(n2.toString());
                        return;
                    }
                    return;
                }
                return;
            case 5:
                HashMap hashMap = co.a;
                ap.dq((String) obj2, (String) ((AtomicReference) obj).get(), 0L, 1);
                return;
            case 6:
                k kVar = (k) obj2;
                List list = (List) obj;
                kVar.getClass();
                dg.b bVar2 = new dg.b();
                bVar2.f(k.b.getData().getYun_user(), k.b.getData().getYun_pass());
                if (k.b.getData().getYun_host().endsWith("/")) {
                    sb = new StringBuilder();
                    sb.append(k.b.getData().getYun_host());
                    str = "PlusNE/";
                } else {
                    sb = new StringBuilder();
                    sb.append(k.b.getData().getYun_host());
                    str = "/PlusNE/";
                }
                sb.append(str);
                JsonHookStatic jsonHookStatic6 = y.by;
                sb.append(jsonHookStatic6.getAppName());
                String sb2 = sb.toString();
                String x = b.x(sb2, "/PlusNE_setting.pn");
                JsonSetting jsonSetting = new JsonSetting();
                jsonSetting.setSetting(new Gson().toJson(list));
                jsonSetting.setSign(NativeTools.k(jsonSetting.getSetting()));
                StringBuilder sb3 = new StringBuilder();
                Activity activity = kVar.d;
                sb3.append(activity.getCacheDir());
                sb3.append("/PlusNE_");
                sb3.append(jsonHookStatic6.getPre());
                sb3.append(System.currentTimeMillis());
                sb3.append(".ne");
                String sb4 = sb3.toString();
                d.g(sb4, new Gson().toJson(jsonSetting));
                try {
                    if (!bVar2.c(sb2)) {
                        bVar2.b(sb2);
                    }
                    fi.y.d();
                    if (bVar2.c(sb2)) {
                        fi.y.e(activity);
                        if (bVar2.c(x)) {
                            z.a aVar2 = new z.a();
                            aVar2.l(x);
                            aVar2.j("DELETE", l.c.d);
                            a.a(bVar2.a.a(aVar2.g()).execute());
                        }
                        bVar2.e(x, new File(sb4));
                        if (bVar2.c(x)) {
                            fVar = new f(activity);
                            fVar.n();
                            str2 = "备份成功";
                        } else {
                            fVar = new f(activity);
                            fVar.j();
                            str2 = "备份失败";
                        }
                        fVar.l(str2);
                        fi.y.d();
                        return;
                    }
                    f fVar3 = new f(activity);
                    fVar3.j();
                    fVar3.l("无法创建文件夹,请检查参数是否填写正确");
                    return;
                } catch (IOException | IllegalArgumentException e) {
                    fi.y.d();
                    e.printStackTrace();
                    f fVar4 = new f(activity);
                    fVar4.j();
                    fVar4.l("请检查参数是否填写正确:" + e.getMessage());
                    return;
                }
            case 7:
                MainActivity mainActivity = (MainActivity) obj2;
                JsonHomeAppList.DataBean dataBean = (JsonHomeAppList.DataBean) obj;
                String str7 = MainActivity.w;
                mainActivity.getClass();
                try {
                    String pre = dataBean.getPre();
                    Iterator it2 = y.ca.entrySet().iterator();
                    while (true) {
                        if (it2.hasNext()) {
                            Map.Entry entry = (Map.Entry) it2.next();
                            if (pre.equals(entry.getValue())) {
                                str3 = (String) entry.getKey();
                            }
                        } else {
                            str3 = null;
                        }
                    }
                    f fVar5 = new f(mainActivity);
                    fVar5.n();
                    fVar5.l("正在重新启动(需要请求Root权限):" + dataBean.getApp());
                    de.aa.ax("am force-stop " + str3);
                    Thread.sleep(1500L);
                    Intent launchIntentForPackage = mainActivity.getPackageManager().getLaunchIntentForPackage(str3);
                    if (launchIntentForPackage != null) {
                        launchIntentForPackage.addCategory("android.intent.category.LAUNCHER");
                        mainActivity.startActivity(launchIntentForPackage);
                        fVar2 = new f(mainActivity);
                        fVar2.n();
                        str4 = "重启完成";
                    } else {
                        fVar2 = new f(mainActivity);
                        fVar2.j();
                        str4 = "应用未安装";
                    }
                    fVar2.l(str4);
                    return;
                } catch (Exception e2) {
                    e2.printStackTrace();
                    f i5 = f.i();
                    i5.j();
                    i5.l(e2.getMessage());
                    return;
                }
            case 8:
                w wVar = new w(y.by.getActivity());
                wVar.bj(fi.e.MESSAGE);
                wVar.aj = "Hook数据变化了";
                wVar.bb();
                wVar.ak = (String) obj2;
                wVar.bb();
                wVar.r = "立即重启";
                wVar.bb();
                wVar.v = new fi.k(24, (JsonTempUserDecrypt) obj);
                wVar.bk();
                p.a.a = wVar;
                return;
            default:
                f fVar6 = (f) obj2;
                String str8 = (String) obj;
                if (fVar6.h && (toast = f.a) != null) {
                    toast.cancel();
                }
                Toast toast2 = fVar6.c;
                if (toast2 != null) {
                    toast2.cancel();
                }
                String h = b.h("[PlusNE]", str8);
                int i6 = fVar6.g;
                Activity activity2 = fVar6.b;
                Toast makeText = Toast.makeText(activity2, h, i6);
                fVar6.c = makeText;
                f.a = makeText;
                LinearLayout linearLayout = new LinearLayout(activity2);
                GradientDrawable gradientDrawable = new GradientDrawable();
                if (r.e.c(activity2)) {
                    gradientDrawable.setColor(Color.parseColor("#1E1F22"));
                } else {
                    gradientDrawable.setColor(-1);
                }
                gradientDrawable.setCornerRadius(r.e.a(activity2, 10.0f));
                linearLayout.setBackground(gradientDrawable);
                TextView textView = new TextView(activity2);
                textView.setId(0x423a35c7);
                textView.setGravity(17);
                textView.setTextSize(15.0f);
                textView.setText("[PlusNE]" + str8);
                textView.setPadding(60, r.e.a(activity2, 10.0f), 60, r.e.a(activity2, 10.0f));
                GradientDrawable gradientDrawable2 = new GradientDrawable();
                textView.setZ(TypedValue.applyDimension(1, 3.0f, activity2.getResources().getDisplayMetrics()));
                int i7 = fVar6.e;
                if (i7 != -1) {
                    gradientDrawable2.setColor(i7);
                }
                int i8 = fVar6.f;
                if (r.e.c(activity2)) {
                    i = 255;
                } else {
                    i = 160;
                }
                textView.setTextColor(au.d.c(i8, i));
                gradientDrawable2.setCornerRadius(r.e.a(activity2, 10.0f));
                textView.setBackground(gradientDrawable2);
                linearLayout.addView(textView);
                fVar6.c.setView(linearLayout);
                int i9 = fVar6.d;
                if (i9 != 48) {
                    if (i9 != 80) {
                        i2 = 0;
                    } else {
                        i2 = 200;
                    }
                } else {
                    i2 = 100;
                }
                fVar6.c.setGravity(i9, 0, i2);
                fVar6.c.show();
                return;
        }
    }
}
